package com.isoftstone.storage;

import java.io.InputStream;
import java.io.OutputStream;

import com.isoftstone.storage.authorization.AuthorizationException;

public interface StreamingStorage extends Storage {
	/**
	 * 从仓库下载远程资源到输出流.
	 * 
	 * @param resourceName
	 *            远程资源名
	 * @param stream
	 *            输出流
	 * @throws TransferFailedException
	 *             如果远程发生访问错误
	 * @throws ResourceDoesNotExistException
	 *             如果指定目录不存在或不是一个目录
	 * @throws AuthorizationException
	 *             如果未授权
	 */
	void getToStream(String resourceName, OutputStream stream)
			throws ResourceDoesNotExistException, TransferFailedException,
			AuthorizationException;

	/**
	 * 复制输入流到仓库目标
	 * 
	 * @param stream
	 *            本地流
	 * 
	 * @param destination
	 *            远程目标
	 * @throws TransferFailedException
	 *             如果远程发生访问错误
	 * @throws ResourceDoesNotExistException
	 *             如果指定目录不存在或不是一个目录
	 * @throws AuthorizationException
	 *             如果未授权
	 */
	void putFromStream(InputStream stream, String destination,
			long contentLength, long lastModified)
			throws TransferFailedException, ResourceDoesNotExistException,
			AuthorizationException;
}
